package com.zwh.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zwh.bean.Emp;
import com.zwh.dao.EmpDao;
import com.zwh.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class EmpServiceImpl implements EmpService {
    @Autowired
    private EmpDao dao;
    @Override
    public List<Emp> getAll() {
        return dao.selectList(null);
    }

    @Override
    public Emp getById(Integer id) {
        return dao.selectById(id);
    }

    @Override
    public List<Emp> getMoreById(List<Integer> list) {
        return dao.selectBatchIds(list);
    }

    @Override
    public int deleteById(Integer id) {
        return dao.deleteById(id);
    }

    @Override
    public int deleteMoreById(List<Integer> list) {
        return dao.deleteBatchIds(list);
    }

    @Override
    public int insert(Emp emp) {
        return dao.insert(emp);
    }

    @Override
    public int updateById(Emp emp) {
        return dao.updateById(emp);
    }

    @Override
    public IPage selectPage(IPage page) {
        return dao.selectPage(page,null);
    }

    @Override
    public IPage selectPage(IPage page, QueryWrapper wrapper) {return dao.selectPage(page,wrapper);
    }

    @Override
    public Page<Emp> EmpAndDept(IPage page) {
        return  dao.selectEmpAndDept(page);
    }
}
